package com.handz.test.config;

import com.handz.test.filter.DemoFilter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 应用模块名称<p>
 *
 * @author hepeiyun
 * @since 2019/11/5
 */
@Slf4j
@Configuration
public class WebConfig {

    @Bean
    public FilterRegistrationBean<DemoFilter> filterRegist(){
        FilterRegistrationBean<DemoFilter> filterRegistrationBean=new FilterRegistrationBean<>();
        filterRegistrationBean.setFilter(new DemoFilter());
        filterRegistrationBean.setOrder(1);
        filterRegistrationBean.setName("filter1");
        filterRegistrationBean.addUrlPatterns("/demo/*");
        log.info("filter is suc");
        return filterRegistrationBean;
    }
}
